<template>
	<view class="">
	<view v-show="aindex == 0" class="pb120">
		<view v-if="isscoll" class=" posifi top0 ibgtoFFF8F9-F1F0FF width1000 zindex9" :style="{height:shh - 5 +'px'}"></view>
		<view class="bg000  size36"></view>
		<image mode="widthFix" :src="imgurl+'homebg.png'" class="image posiab"></image>
		<view :style="{paddingTop:shh - 3 +'px'}"></view>
		<view class="con posire">
			<view @click="navto('/pages/search')" :style="{width:width - menuButtonwidth - 35 +'px'}"
				class="size32 color666 bgF9F9F9 flex-a-i height80 ra16 boxshow " style="border:5px solid #fff;">
				<image mode="widthFix" src="/static/sou.png" class="image mr10 ml20 width40"></image>
				<view class="color999">查单词/词根/课程</view>
			</view>
			<view class="flex-ju-b mt30">
				<image @click="tapupxue" mode="widthFix" :src="imgurl+'kaishi.png'" class="image mr10 "></image>
				<image @click="tapupfu" mode="widthFix" :src="imgurl+'fuxi.png'" class="image ml10 "></image>
			</view>
			<view class="flex-ju-b color222 size22 mt30">
				<view @click="navto('/pages/new_word/index')" class="flex-ju-c flex-col">
					<image mode="widthFix" src="/static/danci.png" class="image posire zindex5 width76"></image>
					<view class="posire width120 flex-ju-c">
						<image mode="widthFix" src="/static/dancis.png" class="image  width120 mt-50"></image>
						<view class="posiab bottom10">单词本</view>
					</view>
				</view>
				<view @click="navto('/pages/box/check')" class="flex-ju-c flex-col">
					<image mode="widthFix" src="/static/pingxie.png" class="image posire zindex5 width76"></image>
					<view class="posire width120 flex-ju-c">
						<image mode="widthFix" src="/static/pingxies.png" class="image  width120 mt-50"></image>
						<view class="posiab bottom10">拼写检查</view>
					</view>
				</view>
				<view @click="navto('/pages/chat_ai?type=1')" class="flex-ju-c flex-col">
					<image mode="widthFix" src="/static/paizhao.png" class="image posire zindex5 width76"></image>
					<view class="posire width120 flex-ju-c">
						<image mode="widthFix" src="/static/paizhaos.png" class="image  width120 mt-50"></image>
						<view class="posiab bottom10">拍照解题</view>
					</view>
				</view>
				<view @click="navto('/pages/chat_ai?type=2')" class="flex-ju-c flex-col">
					<image mode="widthFix" src="/static/koyu.png" class="image posire zindex5 width76"></image>
					<view class="posire width120 flex-ju-c">
						<image mode="widthFix" src="/static/koyus.png" class="image  width120 mt-50"></image>
						<view class="posiab bottom10">口语练习</view>
					</view>
				</view>
				<view @click="navto('/pages/chat_ai?type=0')" class="flex-ju-c flex-col">
					<image mode="widthFix" src="/static/zuoye.png" class="image posire zindex5 width76"></image>
					<view class="posire width120 flex-ju-c">
						<image mode="widthFix" src="/static/zuoyes.png" class="image  width120 mt-50"></image>
						<view class="posiab bottom10">作文批改</view>
					</view>
				</view>
			</view>

			<view class="flex-ju-b color666 size22 mt30">
				<view @click="navto('/pages/chat_ai?type=3')" class="flex-ju-c flex-col width120">
					<image mode="widthFix" src="/static/duanwen.png" class="image  width72"></image>
					<view>单词短文</view>
				</view>
				<view @click="navto('/pages/testing/index')" class="flex-ju-c flex-col width120">
					<image mode="widthFix" src="/static/cihui.png" class="image  width72"></image>
					<view>词汇量测试</view>
				</view>
				<view @click="navto('/pages/chat_ai?type=4')" class="flex-ju-c flex-col width120">
					<image mode="widthFix" src="/static/chat.png" class="image  width72"></image>
					<view>AI聊天</view>
				</view>
				<view @click="navto('/pages/box/index')" class="flex-ju-c flex-col width120">
					<image mode="widthFix" src="/static/manghe.png" class="image  width72 "></image>
					<view>单词盲盒</view>
				</view>
				<view @click="navto('/pages/spelling/index')" class="flex-ju-c flex-col width120">
					<image mode="widthFix" src="/static/ziren.png" class="image  width72"></image>
					<view>自然拼读</view>
				</view>
			</view>

			<view class="flex-ju-b size28 mt60 mb30">
				<view @click="tablist(index)" class="flex-ju-c flex-col" :key="index" :class="{active:tindex==index}"
					v-for="(item,index) in ['课程推荐','词汇量版','考试专属版','其他课程']">
					{{item}}
					<view class="wh64-8 mt5">
						<view class="wh64-8" :class="{bgcoloe:tindex==index}">
						</view>
					</view>
				</view>
			</view>
			<nodata v-if="isdata"></nodata>
			<view v-for="(item,f) in list" :key="f" @click="navto('ke_detail?id='+item.courseId+'&isToll='+item.isToll+'&discountPrice='+item.discountPrice+'&wordCount='+item.wordCount+'&originalPrice='+item.originalPrice)"
				class="bgfff ra20 hidden flex-a-i pg20-15 mb20">
				<view>
					<image :src="item.coverImage" class="wh290-164 ra20"></image>
				</view>
				<view class="ml15 flex1">
					<view class=" height164 flex-ju-b flex-col"  style="align-items: start;">
					<view class="size28 bold one">{{item.courseName}}</view>
					<view class="size24 color666 two">{{item.summary}}</view>
					
					<view class="flex-ju-b width1000 ">
						<view v-if="item.isLearning" class="wh140-48 ra5 bgF3F5F7 color999 size24 flex-ju-c">正在学习</view>
						<image v-else-if="item.isToll==0" mode="widthFix" src="/static/mianfei.png"
							class="width136 image"></image>
						<view v-else-if="item.isToll==2" class="bgFFEFF2 colorFD2F55 ra10 size24 wh140-50 flex-ju-c">去学习
						</view>
						<view v-else class="flex-a-i">
							<template v-if="item.discountPrice>0">
								<view class="size40 colorFD2F55 bold"><text
										class="size22">￥</text>{{item.discountPrice}}</view>
								<view class="size24 color666 deleted-text">{{item.originalPrice}}</view>
							</template>
							<view v-else class="size40 colorFD2F55 bold"><text
									class="size22">￥</text>{{item.originalPrice}}</view>
						</view>
						<view class="size24 color999">共{{item.wordCount}}词</view>
					</view>
				</view>
				</view>
			</view>
			<!-- <view class="flex-ju-c mt50 mb50">
				<image mode="widthFix" src="/static/chaoji.png" class="image width220"></image>
			</view> -->
		</view>
		<uni-popup ref="upxue" type="bottom" @change="changeup" border-radius="20px 20px 0px 0">
			<view class="posire">
				<view class="posiab right30 top30 zindex5" @click="$refs.upxue.close()">
					<image mode="widthFix" src="/static/closes.png" class="image  width65"></image>
				</view>
				<image mode="widthFix" src="/static/topup.png" class="image flex"></image>
				<view class=" posiab top-104 ml30">
					<image mode="widthFix" src="/static/xuexi.png" class="image flex width188"></image>
					<view class="color222 size48 bold">正在学习</view>
				</view>
			</view>
			<view class="posire bgfff pt20 mt-1">
				<image mode="widthFix" src="/static/gengbg.png" class="image posiab flex bottom0"></image>
				<view class="con posire" :style="{paddingBottom:bhh+'px'}">
					<view class="borderFFDEE4 ra20 flex-a-i pg25-20 ">
						<view>
							<image :src="learn.courseCard" class="image wh290-164 ra15"></image>
						</view>
						<view class="flex1 ml15">
							<view class="one size28 bold">{{learn.courseName}}</view>
							<image @click="navto('vocabulary_list?id='+learn.courseId),$refs.upxue.close()"
								mode="widthFix" src="/static/xibbiao.png" class="image width65 flex mt10 mb10"></image>
							<view class="flex-ju-b mt10 mb10">
								<text class="color666 size24">已学 <text class="colorFD2F55">{{learn.leanRootCount}}</text>/{{learn.allRootCount}} 词</text>
							</view>
							<progress border-radius="5" :percent="(learn.leanRootCount/learn.allRootCount * 100).toFixed(2)"
								activeColor="#FD3A5E" backgroundColor="#EBEFF0" stroke-width="5" />
						</view>
					</view>
					<view class="flex-ju-b mt20 posire">
						<view @click="navto('switch'),$refs.upxue.close()" class="bg000 flex1 colorfff flex-ju-c ra20 mr20 size36 height100 mt30">
							更换课程
						</view>
						<view @click="taplist" class="bgFD3A5D colorfff flex-ju-c ra20 size36 height100 mt30 width438">
							开始学习
						</view>
					</view>
				</view>
			</view>
		</uni-popup>

		<uni-popup ref="fuxi" @change="changeup" type="bottom" mask-background-color="rgba(0,0,0,0.76)"  border-radius="20px 20px 0px 0">
			<view class="con pb200">
				<view class="flex-ju-b">
					<view class="posire">
						<image @click="navto('reviewing_word')" mode="widthFix" :src="imgurl+'fuxidancis.png'" class="image width324"></image>
						<image @click.stop="navto('settings?type=1')" mode="widthFix" src="/static/shezhi.png"
							class="image posiab flex width48 top80 right10"></image>
					</view>
					<view class="posire">
						<image @click="navto('reviewing_root')" mode="widthFix" :src="imgurl+'fuxicigen.png'" class="image width324"></image>
						<image  @click.stop="navto('settings?type=2')" mode="widthFix" src="/static/shezhi.png"
							class="image posiab flex width48 top80 right10"></image>
					</view>
				</view>
				<view @click="$refs.fuxi.close()" class="flex-ju-c mt80">
					<image mode="widthFix" src="/static/closeci.png" class="image width80"></image>
				</view>
			</view>
			
			
			
			<!-- <view class="con pt40" :style="{paddingBottom:bhh+'px'}">
				<view class="flex-ju-b">
					<view class="size36 bold">
						选择复习内容
					</view>
					<view @click="$refs.fuxi.close()">
						<uni-icons type="closeempty" size="20"></uni-icons>
					</view>
				</view>
				<view class="bgF9F9F9 ra20 flex-a-i pg25-20 mt20">
					<view>
						<image mode="widthFix" src="/static/fuxidanci.png" class="image width100"></image>
					</view>
					<view @click="navto('reviewing_word')" class="flex1 ml15 flex-ju-b">
						<view class=" ">
							<view class="one size32 bold">单词复习</view>
							<view class="flex-ju-b mt10 mb10">
								<text class="color666 size24">巩固要点，强化实战应用</text>
							</view>
						</view>
						<view class="width60 flex-ju-c">
							<image @click.stop="navto('settings?type=1')" mode="widthFix" src="/static/shezhi.png"
								class="image flex width44"></image>
						</view>
					</view>
				</view>
				<view class="bgF9F9F9 ra20 flex-a-i pg25-20 mt20">
					<view>
						<image mode="widthFix" src="/static/fuxicigen.png" class="image width100"></image>
					</view>
					<view @click="navto('reviewing_root')" class="flex1 ml15 flex-ju-b">
						<view class="flex1">
							<view class="one size32 bold">词根复习</view>
							<view class="flex-ju-b mt10 mb10">
								<text class="color666 size24">精准记忆，攻克遗忘曲线</text>
							</view>
						</view>
						<view class="width60 flex-ju-c">
							<image @click.stop="navto('settings?type=2')" mode="widthFix" src="/static/shezhi.png"
								class="image flex width44"></image>
						</view>
					</view>
				</view>
			</view> -->
		</uni-popup>
		<!-- <uni-popup ref="upke" type="bottom" background-color="#fff" border-radius="20px 20px 0px 0">
			<view class="con pt40 pb50">
				<view class="flex-ju-b">
					<view class="size36 bold">
						解锁课程
					</view>
					<view @click="$refs.upke.close()">
						<uni-icons type="closeempty" size="20"></uni-icons>
					</view>
				</view>
				<view class="size24 color666">解锁可立即学习该课程</view>
				
				<view class=" flex-a-i mt20 mb20 border-bECEDEE pb30 ">
					<view>
						<image mode="widthFix" :src="item.coverImage" class="wh260-150 ra20"></image>
					</view>
					<view class="ml10 flex1">
						<view class="size28 bold one">{{item.courseName}}</view>
						<view class="size24 color666 two">{{item.summary}}</view>
						<view class="flex-ju-b mt10">
							<view class="size24 color666">共 {{item.wordCount}} 词</view>
							<view class="flex-a-i">
								<view class="size24 color666 deleted-text">￥{{item.originalPrice}}</view>
								<view class="size32 colorFD2F55 bold">￥{{item.discountPrice}}</view>
							</view>
						</view>
					</view>
				</view>
				<view class="bg000 flex-ju-b ra20 size32 height100 colorfff  flex1 pr30 pl30 ">
					<view>￥{{item.discountPrice}}</view>
					<view @click="navto('vocabulary_list')">立即解锁</view>
				</view>
			</view>
		</uni-popup> -->
	</view>
	<view class="pb120" v-show="aindex == 1">
		<view>
			<view class="bgFD2F55"></view>
			<image  mode="widthFix" :src="imgurl+'homebg.png'" class="image posiab" style="position: absolute;"></image>
			<view class="con posire">
				<view :style="{paddingTop:shh - 3 +'px'}"></view>
				
				<view @click="navto('/pages/search')" :style="{width:width - menuButtonwidth - 35 +'px'}"
					class="size32 color666 bgF9F9F9 flex-a-i height80 ra16 boxshow " style="border:5px solid #fff;">
					<image mode="widthFix" src="/static/sou.png" class="image mr10 ml20 width40"></image>
					<view class="color999">查单词/词根/课程</view>
				</view>
				
				
				<view class="flex-ju-b size28 color666 mt30 mb30">
					<view @click="tablist1(index)" class="flex-ju-c flex-col " :key="index" :class="{active:tindex1==index}" v-for="(item,index) in ['课程推荐','词汇量版','考试专属版','其他课程']">
						{{item}}
						<view class="wh32-12 ra4  mt8">
							<image v-if="tindex1==index" mode="widthFix" src="/static/tuibottom.png" class="image width32"></image>
						</view>
					</view>
				</view>
				<nodata v-if="isdata"></nodata>
				<scroll-view @scrolltolower="scrolltolower1" class="calm bot" scroll-y>
					 
				<view v-for="(item,f) in list1" :key="f"  @click="navto('/pages/index/ke_detail?id='+item.courseId+'&isToll='+item.isToll+'&discountPrice='+item.discountPrice+'&wordCount='+item.wordCount+'&originalPrice='+item.originalPrice)" class="bgfff ra20 flex-a-i pg20-15 mb20" >
					<view>
						<image :src="item.coverImage" class="wh290-164 ra20"></image>
					</view>
					<view class="ml15 flex1">
						<view class=" height164 flex-ju-b flex-col"  style="align-items: start;">
						<view class="size28 bold one">{{item.courseName}}</view>
						<view class="size24 color666 two">{{item.summary}}</view>
						<view class="flex-ju-b  ">
							<view v-if="item.isLearning" class="wh140-48 ra5 bgF3F5F7 color999 size24 flex-ju-c">正在学习</view>
							<image v-else-if="item.isToll==0" mode="widthFix" src="/static/mianfei.png" class="width136 image"></image>
							<view v-else-if="item.isToll==2" class="bgFFEFF2 colorFD2F55 ra10 size24 wh140-50 flex-ju-c">去学习</view>
							<view v-else class="flex-a-i">
								<template v-if="item.discountPrice>0">
								<view class="size40 colorFD2F55 bold"><text class="size22">￥</text>{{item.discountPrice}}</view>
									<view class="size24 color666 deleted-text">{{item.originalPrice}}</view>
								</template>
								<view v-else class="size40 colorFD2F55 bold"><text class="size22">￥</text>{{item.originalPrice}}</view>
							</view>
							<view class="size24 color999">共{{item.wordCount}}词</view>
						</view>
					</view>
					</view>
				</view>
				 </scroll-view>
				
			</view>
			
			
		</view>
		
	</view>
	<view class="height100vh bgfff " v-show="aindex == 2">
		<view class="">
			
			<view class="width100vw height1001 ibgFEC4CF-ffffff flex-ju-c flex-col center size26">
				<image mode="widthFix" :src="imgurl+'imgkefu.png'" class="width400"></image>
				<view>
					<view class="bold size40 mt30">我的客服</view>
					<view class="color999 mt5">Help Center</view>
				</view>
			</view>
		
				<view class="flex-ju-c">
					<view @click="customer" class="wh600-100 flex-ju-c ra20 colorfff bgFD2F55">
						点击联系客服
					</view>
				</view> 
		
		
		</view>
	</view>
	<view v-show="aindex == 3">
		<view class="posiab width1000">
			<image mode="widthFix" :src="imgurl+'userimg.png'" class="image  "></image>
			<image mode="widthFix" src="/static/userbottom.png" class="image posiab bottom-20" style="position: absolute;"></image>
			<view class="con posire ">
				<view class=" width92vw flex-ju-a color666 bottom50 size24 posiab zindex111">
					<view @click="navto('/pages/user/behead')" class="flex-col flex-ju-c">
						<image mode="widthFix" src="/static/yizhan.png" class="image mb5 width72"></image>
						<view>我的已斩</view>
					</view>
					<view @click="navto('/pages/user/note')" class="flex-col flex-ju-c">
						<image mode="widthFix" src="/static/ubiji.png" class="image mb5 width72"></image>
						<view>我的笔记</view>
					</view>
					<view @click="navto('/pages/user/collect')" class="flex-col flex-ju-c">
						<image mode="widthFix" src="/static/ucangs.png" class="image mb5 width72"></image>
						<view>我的收藏</view>
					</view>
					<view @click="navto('/pages/user/course')" class="flex-col flex-ju-c">
						<image mode="widthFix" src="/static/kke.png" class="image mb5 width72"></image>
						<view>我的课程</view>
					</view>
				</view>
			</view>
		</view>
		
		<view class="con">
			<view class="width92vw pt80  ">
				<view :style="{paddingTop:shh+'px'}"></view>
				<view v-if="user"  class="flex-ju-b posire">
					<view class="flex-a-i">
						<image
							:src="user.avatarUrl?user.avatarUrl:'https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132'"
							class="wh130-130 ra130 mr20"></image>
						<view>
							<view class="flex-a-i size36 color0F172B bold400">
								{{user.nickName?user.nickName:'微信用户'}}
							</view>
							<view class="size24 mt20 color666">UID:{{user.id}}</view>
						</view>
					</view>
					<image @click="upuser" mode="widthFix" src="/static/edit.png" class="width72 flex "></image>
				</view>
				<view v-else @click="uplogin" class="flex-a-i">
					<image
						src="https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132"
						class="wh130-130 ra130 mr20"></image>
					<view>
						<view class="flex-a-i size36 color0F172B bold400">
							点击登录
						</view>
					</view>
				</view>
				<view class="pt300">
		
					<view class="posire size28 bgfff pg30 ra30">
						<view @click="navto('/pages/agreement?type=1')" class="flex-ju-b  pb30 border-bECEDEE">
							<view class="flex-a-i ">
								<image mode="widthFix" src="/static/yingsi.png" class="width40 flex mr10"></image>
								隐私政策
							</view>
							<view>
								<image mode="widthFix" src="/static/right.png" class="width32 flex "></image>
							</view>
						</view>
						<view @click="navto('/pages/agreement?type=2')" class="flex-ju-b  mt30  ">
							<view class="flex-a-i ">
								<image mode="widthFix" src="/static/fuwu.png" class="width40 flex mr10"></image>
								服务条款
							</view>
							<view>
								<image mode="widthFix" src="/static/right.png" class="width32 flex "></image>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<uni-popup @change="changeup" type="bottom" ref='edituser'>
			<image mode="widthFix" :src="imgurl+'userim.png'" class="image flex posiab"></image>
			<view class="posire con pt30" :style="{paddingBottom:bhh+'px'}">
				<view class="flex-ju-b color222 size32 bold">
					<view>编辑资料</view>
					<view @click="$refs.edituser.close()">
						<uni-icons color="#999" type="closeempty" size="30"></uni-icons>
					</view>
				</view>
				<view @click="tapupimg" class="flex-ju-c posire mt50">
					<image
						:src="user.avatarUrl?user.avatarUrl:'https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132'"
						class="wh192-192 image ra160"></image>
					<view class="posiab wh50-50 ra50 bgfff flex-ju-c bottom0 ml130 borderf6f6f6">
						<image src="/static/upaizhaos.png" mode="widthFix" class="width48"></image>
					</view>
				</view>
				<view class="bgfff pg30-20 ra30 mt50">
					<view  class="flex-ju-b  pb30 border-bECEDEE">
						<view class="flex-a-i ">
							昵称
						</view>
						<view class=" text-right flex-a-i size28">
							<input class="flex1" @confirm="tapconfirm" confirm-type="done" v-model="nickName" placeholder-style="font-size:28rpx;" placeholder="输入名称"/>
							<image mode="widthFix" src="/static/right.png" class="width32 flex "></image>
						</view>
						<!-- <view class="flex-a-i">
							{{user.nickName?user.nickName:'微信用户'}}
							<image mode="widthFix" src="/static/right.png" class="width32 flex "></image>
						</view> -->
					</view>
					<view class="flex-ju-b mt30  ">
						<view class="flex-a-i ">
							UID
						</view>
						<view @click="copy(user.id)" class="flex-a-i">
							{{user.id}}
						</view>
					</view>
				</view>
				<view @click="tapout" class="bgfff flex-ju-c pg30-30 ra30 mt20">
					退出当前账户
				</view>
			</view>
		</uni-popup>
		
	</view>
	</view>
	<view class="posifi bgfff width1000 bottom0 bot zindex60 size22 colora9a9a9 " style="box-shadow: 0rpx -4rpx 12rpx 0rpx rgba(0,0,0,0.06);border-radius: 32rpx 32rpx 0rpx 0rpx;">
		<view class="flex-a-i height120">
			<view @click="tabindex(index)" v-for="(item,index) in tablists" :key="index" class="flex1 flex-ju-c flex-col">
				<image mode="widthFix" v-show="aindex == index" :src="item.imgs" class="flex image width64"></image>
				<image mode="widthFix"v-show="aindex != index" :src="item.img" class="flex image width64"></image>
				<view :class="{aactive:aindex == index}">{{item.name}}</view>
			</view>
		</view>
	</view>
	
	
</template>

<script>
	// import Hls from 'hls.js';
	
	export default {
		data() {
			return {
				isscoll:false,
				jindex:[0],
				aindex:0,
				tablists:[
					{name:"首页",img:"/static/tab/home.png",imgs:"/static/tab/homes.png"},
					{name:"课程",img:"/static/tab/ke.png",imgs:"/static/tab/kes.png"},
					{name:"客服",img:"/static/tab/chat.png",imgs:"/static/tab/chats.png"},
					{name:"我的",img:"/static/tab/user.png",imgs:"/static/tab/users.png"}
				],
				tindex: 0,
				learn: {},
				list: [],
				isdata:false,
				menuButtonwidth:0,
				width:0,
				page:1,
				arr:[],
				// 11111
				tindex1:0,
				list1:[],
				// 3333
				code: "",
				user: "",
				nickName:""
			}
		},
		onPageScroll(e) {
			if(this.aindex==0){
				if(e.scrollTop>10){
					this.isscoll=true
				}else{
					this.isscoll=false
				}
			}
		},
	
		onShow() {
			if(this.aindex==0){
				if (uni.getStorageSync('courseid')) {
				this.list.map(item => {
					if (item.courseId == uni.getStorageSync('courseid')) {
						item.isLearning = true
					} else {
						item.isLearning = false
					}
				})
				uni.setStorageSync('courseid', '')
			}
			}else if(this.aindex==3){
				if (uni.getStorageSync('user')) {
					this.user = uni.getStorageSync('user')
					this.nickName = this.user.nickName
				}
			}
			
		},
		
		mounted() {
			
			uni.login({
				provider: 'weixin',
				success: (loginRes) => {
					this.code = loginRes.code
					uni.removeStorageSync('token')
					this.http('/api/wx/login', {
						code: this.code
					}, 'post').then(res => {
						uni.setStorageSync('token', 'Bearer ' + res.data.token)
						uni.setStorageSync('user', res.data.userDto)
						this.getlist(4)
					})
				},
				fail: (res) => {
					console.log(res, "kkk")
					this.getlist(4)
				}
			});
			
		},
		onLoad() {
			
			 this.initAudio();
			// #ifdef MP-WEIXIN
				this.menuButtonwidth = uni.getMenuButtonBoundingClientRect().width
			//#endif
		    this.width =	uni.getSystemInfoSync().screenWidth
			
			
			 // uni.setStorageSync('token','Bearer eyJhbGciOiJIUzI1NiJ9.eyJvcGVuaWQiOiJvUm5GZjE1VW9ZQnA2QlEwSUoxWXNLUmxXbFo4IiwiZXhwIjoxNzYzNzg5NjA4LCJ1c2VySWQiOjN9.J35RQ2CbBo6I43CwOTnxnY4bLPo3zvK4h9WI6X_w98I')
			// uni.setStorageSync('user',{"accountNonExpired":false,"accountNonLocked":false,"authorities":[],"avatarUrl":"http://120.27.207.15:9000/baozou-word/image/VGM4G9ygVvkPfb882db54b40fa5568a68a493831894d.png","credentialsNonExpired":false,"enabled":false,"id":3,"nickName":"663","password":"","username":"663"})
		},
		onReachBottom() {
			this.page++
			this.getlist()
		},
		methods: {
			// 3333333
			tapconfirm(){
				this.http('/api/wxUser',{
					nickname:this.nickName
				},'put').then(resd=>{
					this.toast('修改成功')
					var user = uni.getStorageSync('user')
					user.nickName = this.nickName
					uni.setStorageSync('user',user)
					this.user.nickName = this.nickName
				})
			},
			changeup(e) {
				if (!e.show) {
					uni.showTabBar()
				}
			},
			upuser(){
				this.$refs.edituser.open()
				uni.hideTabBar()
			},
			tapupimg() {
				this.upimg(1).then(res => {
					this.http('/api/wxUser', {
						avatar: res[0]
					}, 'put').then(resd => {
						this.toast('修改成功')
						this.user.avatarUrl = res[0]
						var user = uni.getStorageSync('user')
						user.avatarUrl = res[0]
						uni.setStorageSync('user', user)
					})
				})
			},
			tapout() {
				uni.showModal({
					content: '确定要退出吗？',
					confirmColor:"#FD2F55",
					cancelColor:"#222",
					success: (res) => {
						if (res.confirm) {
							uni.setStorageSync('user', '')
							uni.reLaunch({
								url: "/pages/user/index"
							})
						}
					}
				})
			
			},
			
			uplogin() {
			
				uni.login({
					provider: 'weixin',
					success: (loginRes) => {
						this.code = loginRes.code
						this.http('/api/wx/login', {
							code: this.code
						}, 'post').then(res => {
							this.user = res.data.userDto
							uni.setStorageSync('token', 'Bearer ' + res.data.token)
							uni.setStorageSync('user', res.data.userDto)
							this.nickName = this.user.nickName
						})
					}
				});
			},
			// 111111
			scrolltolower1(){
				console.log(4344)
				this.page++
				this.getlist1()
			},
			tapto(item){
				uni.navigateTo({
					url:"/pages/index/vocabulary_list?id="+item.courseId
				})
			},
			tablist1(index){
				this.page=1
				this.list1 =[]
				this.tindex1 = index
				this.getlist1(index + 1)
			},
			tabindex(index){
				this.page=1
				this.aindex=index
				if(index==1){
					if(this.jindex[index] != index ){
						this.getlist1(4)
					}
				}else if(index==3){
					if (uni.getStorageSync('user')) {
						this.user = uni.getStorageSync('user')
						this.nickName = this.user.nickName
					}
				}
				this.jindex[index]=index
			},
			getlist1(courseType){
				this.http('/api/course/home',{
					courseType: this.tindex1 == 0 ? 4 : this.tindex1,
					pageNo:this.page,
					pageSize:10,
				},'post').then(res=>{
					if(res.data.length){
						 var arr =[]
						res.data.map(item=>{
							arr.push(item.imageId)
						})
						
						this.httpimg(arr).then(ress=>{
							ress.data.map(item=>{
								res.data.map(items=>{
									if(item.fileId == items.imageId){
										items.coverImage = item.fileUrl
									}
								})
							})
							
							this.list1 = [...this.list1,...res.data]
							this.nodata(this.list1,this)
						})
						
					}else{
						this.list1 = [...this.list1,...res.data]
						this.nodata(this.list1,this)
					}
					
				})
			},
			// 111111
			ccccc(){
				this.videoContext.play()
			},
			initAudio() {
				
			  },
			aerror(e){
				console.log(e,"hhhh")
			},
			taplist() {
				if (uni.getStorageSync('record')) {
					if (uni.getStorageSync('record').type == 1) {
						uni.navigateTo({
							url: 'root_detail?id=' + uni.getStorageSync('record').rootId
						})
					} else {
						uni.navigateTo({
							url: 'words_detail?id=' + uni.getStorageSync('record').rootId
						})
					}
				} else {
					this.navto('vocabulary_list?id=' + this.learn.courseId)
				}
				this.$refs.upxue.close()
			},
			getlist(courseType) {
				this.http('/api/course/home', {
					pageNo:this.page,
					pageSize:10,
					courseType: this.tindex == 0 ? 4 : this.tindex
				}, 'post').then(res => {
					
					if(res.data.length){
						 var arr =[]
						res.data.map(item=>{
							arr.push(item.imageId)
						})
						
						this.httpimg(arr).then(ress=>{
							ress.data.map(item=>{
								res.data.map(items=>{
									if(item.fileId == items.imageId){
										items.coverImage = item.fileUrl
									}
								})
							})
							
							this.list = [...this.list,...res.data]
							this.nodata(this.list,this)
						})
						
					}else{
						this.list = [...this.list,...res.data]
						this.nodata(this.list,this)
					}
					
				 
					
				})
			},
			tapupfu() {
				uni.hideTabBar()
				this.$refs.fuxi.open()
			},
			changeup(e) {
				if (!e.show) {
					uni.showTabBar()
				}
			},
			tapupxue() {
				this.http('/api/course/learn').then(res => {
					this.learn = res.data
					uni.hideTabBar()
					this.$refs.upxue.open()
				})
			},
			tablist(index) {
				this.page=1
				this.list=[]
				this.tindex = index
				this.getlist(index + 1)
			}
		}
	}
</script>

<style>
	page {
		background: #F3F5F7;
	}

	.bgcoloe {
		background: linear-gradient(270deg, #FD4365 0%, #FF90A4 100%);
		border-radius: 200rpx 0rpx 200rpx 0rpx;
	}

	.deleted-text {
		text-decoration: line-through;
	}

	.active {
		font-size: 36rpx;
		font-weight: bold;
	}

	.boxshow {
		box-shadow: 0rpx 4rpx 30rpx 0rpx rgba(0, 0, 0, 0.1);
	}
	.aactive{
		color:#222222;
		font-weight: 500;
	}
	.color07 {
		color: rgba(255, 255, 255, 0.7);
	}
	.calm{
		height: calc(100vh - 120rpx - 300rpx);
	}
</style>